﻿using System.Collections.Generic;
using EzDesk.DevHelper.DbMgr.ToEzLanguage;

namespace EzDesk.DevHelper.DbMgr.FeedStudio.ToEzLanguage
{
    public class EzLanguageBuilder
    {
        private readonly string _textSource;

        readonly List<EzMLProcessor> _processors = new List<EzMLProcessor>();

        public EzLanguageBuilder(string textSource, string sectionName)
        {
            this._textSource = textSource;

            _processors.Add(new BasicInfoProcessor(sectionName));
            _processors.Add(new LinkProcessor());
            _processors.Add(new ImptProcessor());
            _processors.Add(new ReplaceTextProcessor());
            _processors.Add(new ReplacementProcessor());
            _processors.Add(new NewLineProcessor());
            _processors.Add(new UserInfoProcessor());
            _processors.Add(new WeakProcessor());
            _processors.Add(new StrongProcessor());
            _processors.Add(new LineBreakProcessor());

        }

        public string Build()
        {
            string source = _textSource;
            foreach (var processor in _processors)
            {
                source = processor.Process(source);
            }
            return source;
        }
    }
}

